﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Cips.DataMining.Tests
{
    [TestClass]
    public class NGramTests
    {
        [TestMethod]
        public void NGramsShouldHaveProperEqualitySemantics()
        {
            var data1 = new[] {1, 2, 3};
            var data2 = new[] {3, 2, 1};
            var data3 = new[] {1, 2};

            Assert.AreEqual(new NGram(data1), new NGram(data1));
            Assert.AreEqual(new NGram(data2), new NGram(data2));
            Assert.AreNotEqual(new NGram(data1), new NGram(data2));
            Assert.AreNotEqual(new NGram(data1), new NGram(data3));

            Assert.AreEqual(new NGram(data1).GetHashCode(), new NGram(data1).GetHashCode());
            Assert.AreEqual(new NGram(data2).GetHashCode(), new NGram(data2).GetHashCode());
            Assert.AreNotEqual(new NGram(data1).GetHashCode(), new NGram(data2).GetHashCode());
            Assert.AreNotEqual(new NGram(data1).GetHashCode(), new NGram(data3).GetHashCode());
        }
    }
}
